import java.util.Arrays;
import java.util.Iterator;
import java.util.List;

public class 四种遍历方法 {
    public static void main(String[] args) {
        四种遍历();

    }

    private static void 四种遍历() {
        List<String> list= Arrays.asList("aaa","bbb","ccc","ddd");
        for(int i=0;i<list.size();i++){
            System.out.println(list.get(i)+" ");
        }
        System.out.println();
        for(String str:list){
            System.out.println(str+" ");
        }
        System.out.println();
        Iterator<String> it=list.iterator();
        while(it.hasNext()){
            String str= it.next();
            System.out.println(str+" ");
        }
        System.out.println();
    }
}
